<!-- 话题Item组件 -->
<template>
	<view class="topic_item">
		<view class="item" v-for="(item, index) in dataList" @click.stop="$emit('goDetail', item)">
			<view class="top">
				<view class="left">
					<avatar class="avatar" :src="item.headPortrait"></avatar>
					<view>
						<text>{{ item.nickName }}</text>
						发布
					</view>
				</view>
				<view class="right" v-if="type == 1">
					<text>{{ item.examine != 1 ? '仅自己可见' : '' }}</text>
				</view>
				<view class="right" v-if="type == 2">
					<text>{{ item.readNum ? item.readNum : 0 }}</text>
					人参与
				</view>
			</view>

			<view class="title">
				<view>{{ item.title }}</view>
			</view>

			<view class="texts">
				<view v-for="(words, idx) in item.words" :key="idx">#{{ words }}#</view>
			</view>

			<!-- 以下内容用于我的发布话题 -->
			<!-- status -1 待发布 0 启用  1 禁用 -->
			<block v-if="type == 1">
				<view v-if="item.status >= 0" class="isMyFb">
					<view>
						<text>{{ item.readNum }}</text>
						人参与
					</view>
					<view>
						发起于:
						<text>{{ item.createTime }}</text>
					</view>
				</view>
				<view class="isMyFb" v-if="item.status==-1||item.examine==2">
					<view>
						创建于:
						<text>{{ item.createTime }}</text>
					</view>
					<view style="display: flex;">
						<view class="handler" @click.stop="$emit('continueRelease', item.id)">继续发布</view>
						<view class="handler del" @click="$emit('delRelease', item.id)">删除</view>
					</view>
				</view>
			</block>
			<!-- 审核状态 -->
			<!--  examine 0：待审核，1：审核通过，2：驳回 -->
			<view class="status" v-if="type == 1 && item.status == 0">
				<image v-if="item.examine == 0" src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/myTopic/img3.png"></image>
				<image v-if="item.examine == 1" src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/myTopic/img1.png"></image>
				<image v-if="item.examine == 2" src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/mine/myTopic/img2.png"></image>
			</view>
			<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/bg1.png" class="img_position"></image>
		</view>
	</view>
</template>

<script>
import avatar from '@/components/avatar.vue';
export default {
	components: {
		avatar
	},
	props: {
		dataList: {
			type: Array,
			default: () => []
		},
		type: {
			type: Number,
			default: null
			//（1：我发布的，2：我查看的)
		}
	}
};
</script>

<style lang="scss" scoped>
.topic_item {
	width: 100%;
	height: 100%;
	padding: 8rpx 32rpx 0 30rpx;
	background-color: #f8f8f8;
	box-sizing: border-box;
	.item {
		width: 100%;
		border-radius: 20rpx;
		margin-top: 26rpx;
		background-color: #fff;
		box-sizing: border-box;
		position: relative;
		overflow: hidden;
        .img_position{
			width: 156rpx;
			height: 146rpx;
			position: absolute;
			right: 0;
			top: 180rpx;
		}
		.status {
			width: 114rpx;
			height: 106rpx;
			position: absolute;
			right: 10rpx;
			top: 70rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.isMyFb {
			position: relative;
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 0 24rpx 40rpx;
			font-size: 26rpx;
			font-weight: 500;
			color: #959595;
			z-index: 9;
			.handler {
				padding: 10rpx 20rpx;
				border-radius: 15rpx;
				color: #ffffff;
				background-color: #3c9cff;
			}
			.del {
				margin: 0 5rpx;
				background-color: #d93025;
			}
		}

		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 42rpx 26rpx 34rpx;
			border-bottom: 1rpx dashed #e5eae9;

			.left {
				display: flex;
				align-items: center;

				.avatar {
					width: 52rpx;
					height: 52rpx;
					border-radius: 50%;
					margin-right: 22rpx;
				}

				view {
					font-size: 26rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #7e7e7e;
				}
			}

			.right {
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #7e7e7e;
			}
		}

		.title {
			font-size: 36rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			color: #303030;
			padding: 0 24rpx;
			margin-top: 34rpx;
		}

		.texts {
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			padding: 30rpx 22rpx 44rpx;

			view {
				margin-right: 26rpx;
				font-size: 26rpx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				color: #4f9bf1;
			}
		}
	}
}
</style>
